package com.my.thread.syncRetuen.threadLocal;

//可以在业务层，在某处读取context对象 只针对当前线程 好处-不用写往下传递参数
public class MyThreadLocal {
    //防止内存溢出
    // 每次使用完都调用remove
    // public static 设置为强引用从而随时清楚
    public static final ThreadLocal userTreadLocal = new ThreadLocal();

    public static Object get(){
        return userTreadLocal.get();
    }

    public static void set(Object o){
        userTreadLocal.set(o);
    }

    public static void remove(){
        userTreadLocal.remove();
    }
}
